package com.tdx.blog_nowcoder.msg;

/**
 * @author 何可人
 * @version 1.0
 * @description: TODO
 * @date 2022/8/4 16:36
 */

import com.tdx.blog_nowcoder.utils.SpringContextUtil;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 /**
 * @author tdx
 * @version 1.0
 * @description: TODO
 * @date 2022/8/4 16:36

 **/
public class MessageSourceUtil {
    public static String getMsgSource() throws UnknownHostException {
        String host = InetAddress.getLocalHost().getHostAddress();
        Environment env = SpringContextUtil.getBean(Environment.class);
        String port = env.getProperty("server.port");
        return host+":"+port;
    }
}
